%% Based on a TeXnicCenter-Template by Gyorgy SZEIDL.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------
%
\documentclass[a4paper,12pt,oneside,reqno,openbib]{book}%
%----------------------------------------------------------
% This is a sample document for the standard LaTeX Book Class
% Class options
%       --  Body text point size:
%                        10pt (default), 11pt, 12pt
%       --  Paper size:  letterpaper (8.5x11 inch, default)
%                        a4paper, a5paper, b5paper,
%                        legalpaper, executivepaper
%       --  Orientation (portrait is the default):
%                        landscape
%       --  Printside:   oneside, twoside (default)
%       --  Quality:     final(default), draft
%       --  Title page:  titlepage, notitlepage
%       --  Columns:     onecolumn (default), twocolumn
%       --  Start chapter on left:
%                        openright(no, default), openany
%       --  Equation numbering (equation numbers on right is the default):
%                        leqno
%       --  Displayed equations (centered is the default):
%                        fleqn (flush left)
%       --  Open bibliography style (closed bibliography is the default):
%                        openbib
% For instance the command
%          \documentclass[a4paper,12pt,reqno]{book}
% ensures that the paper size is a4, fonts are typeset at the size 12p
% and the equation numbers are on the right side.
%
\usepackage{fullpage} % this would use more of the page, but would prevent todo notes and does not leave place for notes
%---------------------------------------------------------------------
\usepackage{courier}
\usepackage[
  %disable
  %textwidth=1cm
]{todonotes} % manual from http://www.tex.ac.uk/tex-archive/macros/latex/contrib/todonotes/todonotes.pdf
%examples:
%\todo[inline]{Add schedule table}
%\missingfigure[figwidth=0.8\columnwidth]{need to place figure here}
%---------------------------------------------------------------------
\usepackage{ifthen} % needed for glossaries and links
\newboolean{bOnlineVersion}
\setboolean{bOnlineVersion}{true}

\usepackage{amsmath}%
\usepackage{amsfonts}%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{amssymb}%
\usepackage{tabulary}% fixes a lot of table problems! http://nepsweb.co.uk/docs/tableTricks.pdf
\usepackage{array}%it extends the possibility of LaTeX to handle tables
%\usepackage{footnote} % allows footnotes in floating environment, see http://ewus.de/tipp-1060.html
\usepackage{caption} % allows labeling any objects
%---------------------------------------------------------------------
%graphic library for flow charts (http://www.texample.net/tikz/examples/simple-flow-chart/)
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,shadows,arrows}

%---------------------------------------------------------------------
\usepackage{graphicx}%
\usepackage{epstopdf}


%---------------------------------------------------------------------
% http://en.wikibooks.org/wiki/LaTeX/Packages/Listings
% http://stackoverflow.com/questions/741985/latex-source-code-listing-like-in-professional-books
\usepackage{listings}
\lstset{ %
	basicstyle=\footnotesize\ttfamily,
	numbers=left,                   % where to put the line-numbers
	numberstyle=\footnotesize,      % the size of the fonts that are used for the line-numbers
	stepnumber=1,                   % the step between two line-numbers. If it's 1 each line 
	                                % will be numbered
	numbersep=5pt,                  % how far the line-numbers are from the code
	backgroundcolor=\color{black!0},  % choose the background color. You must add \usepackage{color}
	showspaces=false,               % show spaces adding particular underscores
	showstringspaces=false,         % underline spaces within strings
	showtabs=false,                 % show tabs within strings adding particular underscores
	%frame=single,	                % adds a frame around the code
	tabsize=2,	                    % sets default tabsize to 2 spaces
	captionpos=t,                   % sets the caption-position to bottom
	breaklines=true,                % sets automatic line breaking
	breakatwhitespace=false,        % sets if automatic breaks should only happen at whitespace
	title=\lstname,                 % show the filename of files included with \lstinputlisting;
	                                % also try caption instead of title
	escapeinside={\%*}{*)}         % if you want to add a comment within your code
%	xleftmargin=17pt,
%	framexleftmargin=17pt,
%	framexrightmargin=5pt,
%	framexbottommargin=4pt,
}

\definecolor{javared}{rgb}{0.6,0,0} % for strings
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
\definecolor{mauve}{rgb}{0.58,0,0.82}

\lstset{
	language=Java,
	keywordstyle=\color{javapurple}\bfseries,
	emphstyle=\color{blue},
	stringstyle=\color{javared},
	commentstyle=\color{javagreen},
	morecomment=[s][\color{javadocblue}]{/**}{*/},
	numberstyle=\tiny\color{black},
	% if you want to add more keywords to the set
	morekeywords={
		uint8_t,
		int8_t,
		uint16_t,
		uint32_t,
		*,
		...,
		end,
		attribute,
		varying,
		uniform,
		sampler2D,
		vec2,
		vec4},
	emph={
		length,
		GREY,
		CPU,
		CPU_FPU,
		gl_Position,
		gl_FragColor}
}

 \DeclareCaptionFont{white}{\color{white}}
 \DeclareCaptionFormat{listing}{\colorbox[cmyk]{0.43, 0.35, 0.35,0.01}{\parbox{\textwidth}{\hspace{15pt}#1#2#3}}}
 \captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white, singlelinecheck=false, margin=0pt, font={bf,footnotesize}}
%---------------------------------------------------------------------

\usepackage[final]{pdfpages} % http://de.wikibooks.org/wiki/LaTeX-W%C3%B6rterbuch:_includepdf
\pdfoptionpdfminorversion=5 % eleminate: PDF inclusion: found PDF version <1.5>, but at most version <1.4> allowed

% enable clickable hyperlinks:
% see http://theoval.cmp.uea.ac.uk/~nlct/latex/pdfdoc/pdfdoc/pdfdoc.html (Duplicate page numbers problem)
% see http://en.wikibooks.org/wiki/LaTeX/Hyperlinks
\usepackage[plainpages=false]{hyperref}
%----------------------------------------------------------
%hyperref setup:
\hypersetup{
  %bookmarks=true,        % show bookmarks bar?
  unicode=true,          % non-Latin characters in Acrobatï¿œs bookmarks
  pdftoolbar=true,        % show Acrobat's toolbar?
  pdfmenubar=true,        % show Acrobat's menu?
  pdffitwindow=false,     % window fit to page when opened
  pdfstartview={FitH},    % fits the width of the page to the window
  pdftitle={PAIND Bilderverarbeitung auf GPU},    % title
  pdfauthor={Klemens Imholz},     % author
  pdfsubject={PAIND at the Lucerne University of Applied Sciences and Arts},   % subject of the document
  pdfcreator={Klemens Imholz},   % creator of the document
  pdfproducer={Klemens Imholz}, % producer of the document
  pdfkeywords={BDA,} {Lucerne University of Applied Sciences and Arts,} {PC Programming}, % list of keywords
  pdfnewwindow=true,      % links in new window
  colorlinks=true         % false: boxed links; true: colored links
}
\ifthenelse{\boolean{bOnlineVersion}}{
\hypersetup{
  linkcolor=blue,         % color of internal links
  citecolor=blue,         % color of links to bibliography
  filecolor=blue,         % color of file links
  urlcolor=blue           % color of external links
  }
}{
\hypersetup{
  linkcolor=black,         % color of internal links
  citecolor=black,         % color of links to bibliography
  filecolor=black,         % color of file links
  urlcolor=black           % color of external links
  }
}
%----------------------------------------------------------

% tocloft: see http://tex.stackexchange.com/questions/26732/how-to-get-a-list-of-appendices
\usepackage{tocloft}

\newcommand{\listcorrespondencesname}{Korrespondenz}
\newlistof{correspondences}{corr}{\listcorrespondencesname}
\newcommand{\correspondences}[1]{\addcontentsline{corr}{correspondence}{#1}}
\newcommand{\newcorrespondence}[1]{\subsection*{#1}\correspondences{#1}}
% use \newcorrespondence
% and \listofcorrespondences




% glossary support (see http://en.wikibooks.org/wiki/LaTeX/Glossary) and http://ewus.de/tipp-1026.html and https://ewus.de/tipp-1029.html
%\usepackage[xindy]{glossaries}

\usepackage{framed}

\sloppy % relax hyphenation for block typesetting

\usepackage[
	%nonumberlist, %do not show page numbers
	acronym,      %create an acronym list
	toc,          %list entries in table of contents
	%section      %show entries in table of content on section level
	]
{glossaries}

%Create new glossary
\newglossary[slg]{symbolslist}{syi}{syg}{Symbols}

%Disable the dot at the end of each description
\renewcommand*{\glspostdescription}{}

\makeglossaries % enable glossary commands
\input{tex/Glossary.tex} %include glossary items (glossary, acronyms and symbols)

\usepackage{makeidx}
\makeindex % we want to generate an index


% new theorem support (see http://en.wikibooks.org/wiki/LaTeX/Theorems)
\newtheorem{theorem}{Theorem}
\newtheorem{acknowledgement}[theorem]{Acknowledgement}
\newtheorem{algorithm}[theorem]{Algorithm}
\newtheorem{axiom}[theorem]{Axiom}
\newtheorem{case}[theorem]{Case}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{conclusion}[theorem]{Conclusion}
\newtheorem{condition}[theorem]{Condition}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{criterion}[theorem]{Criterion}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{problem}[theorem]{Problem}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{summary}[theorem]{Summary}
\newenvironment{proof}[1][Proof]{\textbf{#1.} }{\ \rule{0.5em}{0.5em}}

\setcounter{tocdepth}{2} %0: upt to chapters, 1: up to sections

% from http://www.alfredklomp.com/programming/tex/macros/
\long\def\greybox#1{%
    \newbox\contentbox%
    \newbox\bkgdbox%
    \setbox\contentbox\hbox to \hsize{%
        \vtop{
            \kern\columnsep
            \hbox to \hsize{%
                \kern\columnsep%
                \advance\hsize by -2\columnsep%
                \setlength{\textwidth}{\hsize}%
                \vbox{
                    \parskip=\baselineskip
                    \parindent=0bp
                    #1
                }%
                \kern\columnsep%
            }%
            \kern\columnsep%
        }%
    }%
    \setbox\bkgdbox\vbox{
        \pdfliteral{0.85 0.85 0.85 rg}
        \hrule width  \wd\contentbox %
               height \ht\contentbox %
               depth  \dp\contentbox
        \pdfliteral{0 0 0 rg}
    }%
    \wd\bkgdbox=0bp%
    \vbox{\hbox to \hsize{\box\bkgdbox\box\contentbox}}%
    \vskip\baselineskip%
}


%\DeclareCaptionFont{red}{\normalcolor}
%----------------------------------------------------------
\begin{document}
%own chapter numbering
%\renewcommand{\thechapter}{\thepart-\arabic{chapter}}

\input{tex/Title.tex}
\cleardoublepage
\pagenumbering{roman}

\tableofcontents
\clearpage
\listoffigures
\listoftables

%	\todototoc
\ifthenelse{\boolean{bOnlineVersion}}{
%	\listoftodos
%	\todo[inline]{Perform complete spelling check}
}{}

\mainmatter

\input{tex/Abstract.tex}
\input{tex/Introduction}

\part{Werkzeug und Grundlagen}
\input{tex/DeviceDescription}
\input{tex/Tools_SW_development}

\input{tex/OpenGL_ES_20}
\input{tex/ImageProcessing}
\input{tex/SimpleUserInterface}

\part{Demo-Applikation}
\input{tex/DemoApp}

\part{Verifikation Demo-Applikation}
\input{tex/CpuVsGpu}
\input{tex/Fazit}
\input{tex/Summary}

\part{Anhang}

\ifthenelse{\boolean{bOnlineVersion}}{
\chapter{Messresultate CPU, CPU\_FPU und GPU}
\begin{table}[!h]
\centering
\includegraphics[width=0.9\textwidth]{fig/tableMeasureCpuVsGpu}
\caption{Messresultate}
\label{tab:measureSnapShot}
\end{table}

\chapter{Projektaufwand-Diagramm}
%\include{tex/WorkEffort}
\begin{figure}[!h]
\centering
\includegraphics[width=0.8\textwidth]{fig/projectWorkPie}
\caption{Prozentualer Projektaufwand. Total 218 Std.}
\label{fig:prjRessources}
\end{figure}

%\chapter{Protokolle}
%\include{tex/MinutesOfTheMeeting}
%\include{tex/Correspondence}
%\chapter{Javadoc}
\includepdf[pages=-,link=true
, addtotoc={
%page, section,		deep, Title, label}
1, chapter, 1, Javadoc, javadoc}
]{pdfdoclet/javadoc.pdf}
}{
\section{Anhangsverzeichnis}
\begin{itemize}
\item Messresultate CPU, CPU\_FPU und GPU
\item Projektaufwand-Diagramm
\item Javadoc
\end{itemize}
}

%Glossary
\printglossary[style=altlist, title=Glossar, toctitle=Glossar]

%Acronyms
\printglossary[type=\acronymtype, style=long, title=Abkürzungen, toctitle=Abkürzungen]

%Symbols
\printglossary[type=symbolslist,style=long,title=Symbole,toctitle=Symbole]

%Index
\printindex

%Bibliography
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Literaturverzeichnis}
\nocite{*} %reference everything in the bibliogrphy
\bibliographystyle{plain}
\bibliography{tex/Bibliography}

%\backmatter
%\input{tex/ChapterAfterword.tex}


\end{document}
